import {_decorator, Component, Label} from 'cc';
import {EventManager} from "db://assets/scripts/common/EventManager";
import {EventType} from "db://assets/scripts/common/EventType";

const {ccclass, property} = _decorator;

@ccclass('StepController')
export class StepController extends Component {

    onEnable() {
        // 系统事件

        // 自定义事件
        EventManager.on(EventType.UI_STEP_SET_STEP, this.setStep, this);
    }

    onDisable() {
        // 系统事件

        // 自定义事件
        EventManager.off(EventType.UI_STEP_SET_STEP, this.setStep, this);
    }

    /**
     * 显示步数
     *
     * @param step 步数
     */
    public setStep(step: number) {
        console.log(step);
        console.log(this.node === null);
        console.log(this.node === undefined);
        // this.node.getComponent(Label).string = step.toString();
    }

}